import {request} from "@/request";


export const get = function (url, params) {
    return new Promise((resolve, reject) => {
        request.get(url, {params}).then(res => {
            if (res.code === 200) {
                return resolve(res)
            } else {
                return reject(res)
            }
        }).catch(err => {
            return  reject(err)
        })
    })
}

export const post = function (url, data) {
    return new Promise((resolve, reject) => {
        request.post(url, data).then(res => {
            if (res.code === 200) {
                return resolve(res)
            } else {
                return reject(res)
            }

        }).catch(err => {
            return reject(err)
        })
    })
}